import { Component, OnInit, ViewChild } from '@angular/core';

@Component({
  selector: 'app-demo5',
  templateUrl: './demo5.component.html',
  styles: []
})
export class Demo5Component implements OnInit {
  visible;
  @ViewChild('popover', { static: false }) popover;
  constructor() {}

  ngOnInit() {}

  close() {
    new Promise(resolve => {
      if (window.confirm('是否关闭?')) {
        this.popover.hide();
      }
    });
  }

  open() {
    this.visible = true;
  }

  changeVisible() {
    if (window.confirm('是否关闭?')) {
      this.visible = false;
    }
  }
}
